/********************************************************************
	Created:	2011/02/22    13:55 
	Filename: 	ComponentManager.h
	Author:		falconwang
*********************************************************************/

#ifndef ComponentManager_H__
#define ComponentManager_H__

#include <string>
#include <map>

namespace Ent
{
	class Component;

	class ComponentManager
	{
	public:

		static ComponentManager*	Instance()
		{
			static ComponentManager self;
			return &self;
		}

		~ComponentManager();

		void		AddComponent(const std::string& _eId, Component* _comp);
		void		RemoveComponent(const std::string& _eId, Component* _comp);
		Component*	GetComponent(const std::string& _eId);

		void		Update(float delta);

		const std::string&	GetFamily() const { return m_Family; }

	private:
		ComponentManager(const std::string& _family = "Default");
		ComponentManager(const ComponentManager& _other);

	private:
	
		std::map<std::string, Component*>	m_Comps;

		std::string							m_Family;
	};
}

#endif // ComponentManager_H__